package code;

import java.util.ArrayList;
import java.util.LinkedList;

public interface IPhotoAlbum extends IDateBasedFile {

	/**
	 * Call this method on the album you want to treat as the root Depth first search for an album with no children, i.e. iterate through
	 * children of the initial album. Recurse through each child album till there are no more children albums. For that album, move the
	 * files to the parent if there are no duplicates. Remove the album and exit, allowing the recursion to pick up the root directory for
	 * exit criteria.
	 * 
	 * @param fromAlbum Model of an album structure with number of photos in each album -a0 root, has children, so iterate through them. a1
	 *            has no children, so just move files to here -a1 -a2 children have no children, so move their photos to here -a4 never
	 *            recurse to here because there are no children, but the 4 photos are moved to a2 -a5 never recurse to here because there
	 *            are no children, but the 5 photos are moved to a2 -a3
	 * @return returns success.
	 */
	public abstract boolean collapseAlbums();

	/**
	 * Will return the total number of albums in this album
	 * 
	 * @return
	 */
	public abstract int albumsCount();

	/**
	 * Returns the child album at the given index.
	 * 
	 * @param index must be an index less than countAlbums()
	 * @return returns the matching album for the given index.
	 */
	public abstract IPhotoAlbum albumAt(int index);

	/**
	 * Count the number of child albums.
	 * 
	 * @param recursive optionally recurses to give the total number of albums under this one.
	 * @return the number of child albums (recursive optional)
	 */
	public abstract int albumsCountRecursive();

	/**
	 * This overload will return the total number of photos in this album and all children.
	 * 
	 * @return returns the number of photos
	 */
	public abstract int photosCount();

	/**
	 * This overload will return the total number of photos in this album and all children.
	 * 
	 * @param recursive
	 * @return
	 */
	public abstract int photosCountRecursive();

	/**
	 * Returns the photo at the given index.
	 * 
	 * @param index must be an index less than countPhotos()
	 * @return returns the matching photo for the given index.
	 */
	public abstract IPhotoFile photoAt(int index);

	public abstract boolean deleteAlbum();

	public abstract ArrayList<DateFormat> getAlternateFormats();

	public abstract LinkedList<IPhotoAlbum> getChildAlbums();

	public abstract ArrayList<IPhotoFile> getPhotos();

	/**
	 * Move photos in the childAlbum to the given destination. Assumes that the destination is not a sub-directory of child.
	 * 
	 * @param childAlbum
	 * @return returns true if all of the files were moved (ie, no conflicts or errors).
	 */
	public abstract boolean moveFilesHere(IPhotoAlbum childAlbum);

	/**
	 * Refresh knowledge about the photos that are in this album and all children.
	 */
	public abstract void refreshAlbumContents();

	public abstract void renamePhotosInAlbums();

	public abstract void setChildAlbums(LinkedList<IPhotoAlbum> childAlbums);

	public abstract void setPhotos(ArrayList<IPhotoFile> photos);
}